package com.itheima;

import java.util.Random;

public class demo08 {
    public static int[] arr = new int[9];

    public static void main(String[] args) {
        Random r = new Random();
        for (int i = 0, temp = 0; i < arr.length; i++) {
            do {
                temp = r.nextInt(10) + 1;
            } while (check(temp));
            arr[i] = temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }

    public static boolean check(int num) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num)
                return true;
        }
        return false;
    }
}
